<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然企业级管理平台</title>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <div class="form-horizontal  h-form-warp">
          <form action="/apiDatabaseDocConfig/saveApiDatabaseDocConfig" class="form-horizontal"
                id="apiDatabaseDocConfigForm"
                method="post" role="form">
            <input class="form-control" id="id" name="id" type="hidden" value="${apiDatabaseDocConfig.id!}">
            <input id="operation" name="operation" type="hidden"/>
            <input class="form-control" id="databaseId" name="databaseId" type="hidden"
                   value="${apiDatabaseDocConfig.databaseId!}"/>
            <div class="form-group">
              <label class="col-sm-2 control-label">发布作者 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="publishAuthor" name="publishAuthor"
                       type="text" value="${apiDatabaseDocConfig.publishAuthor!}"/>
              </div>
            </div>
            <div class="form-group">
              <@PageDict dict_name="generateDocColorStyle" dict_desc="生成文档背景颜色" dict_key="generate_doc_color_style"
              dict_value="${apiDatabaseDocConfig.generateDocColorStyle!}" dict_type="select"
              label_class="col-sm-2 control-label text-right" dict_class="col-sm-8" required="required" />
            </div>
            <div class="form-group">
              <@PageDict dict_name="generateDocType" dict_desc="生成文档类型【doc,excel,pdf】" dict_key="generate_doc_type"
              dict_value="${apiDatabaseDocConfig.generateDocType!}" dict_type="select"
              label_class="col-sm-2 control-label text-right" dict_class="col-sm-8" required="required"
              default_value="excel"/>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">生成文档表前缀 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="generateTablePrefix" name="generateTablePrefix"
                       placeholder="不填写则生成所有表数据" type="text" value="${apiDatabaseDocConfig.generateTablePrefix!}"/>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">excel背景颜色参考：</label>
              <div class="col-sm-8">
                <input src="/images/excel_color_style.png" type="image"/>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
    <!-- end: PAGE -->
  </div>
  <!-- end: MAIN CONTAINER -->
</div>

<#include "/common/jslib.html">
<!-- 弹窗下拉 -->
<script type="text/javascript">
    $(function () {
        // 弹出窗体控制
        var api = frameElement.api;
        var W = api.opener;
        ApiDatabaseDocConfigMgr = {
            // 初始化
            init: function () {
                api.button({
                    id: 'ok',
                    name: '确认生成',
                    callback: ApiDatabaseDocConfigMgr.generateDatabaseDoc
                });
                api.button({
                    id: 'cancel',
                    name: '关闭'
                });
            },
            // init end
            // 提交数据
            generateDatabaseDoc: function () {
                $("#operation").val("add");
                Jmts.ajaxSubmit(document.getElementById("apiDatabaseDocConfigForm"), function (result) {
                    if (result.success) {
                        var generateTablePrefix = $("#generateTablePrefix").val();
                        window.location.href =
                            "/apiDatabaseDocConfig/generateDatabaseDoc?databaseId=" + result.resultData.databaseId +
                            "&generateTablePrefix=" + generateTablePrefix;
                    } else {
                        Jmts.warnTips(result.msg);
                    }
                });
                return false;
            },
            // submitForm end
            returnIndex: function () {
                window.location.href = "/apiDatabaseDocConfig/query";
            }
        };
        // 执行初始化
        ApiDatabaseDocConfigMgr.init();
        // 前台验证表单
        $("#apiDatabaseDocConfigForm").validate();
    });
</script>
</body>
</html>
